package lab.southpark.demo.unitTests
{
    import com.southpark.demo.interfaces.model.IModel;
    import com.southpark.system.interfaces.application.IApplication;
    import com.southpark.system.interfaces.managers.IApplicationManager;
    
    import flash.events.TimerEvent;
    import flash.utils.Timer;
    
    import flexunit.framework.TestCase;
    
    import mx.core.FlexGlobals;
    
    
    public class BaseTestCase extends TestCase
    {
        
		protected var applicationManager:IApplicationManager = IApplication(FlexGlobals.topLevelApplication).applicationManager;
		protected var model:IModel = applicationManager.model as IModel;
         
        
        override public function setUp():void
	    {
	    	trace("setUp");
	    }
	    
	    override public function tearDown():void
	    {
	    	trace("tearDown");
	    }
		
		protected function waitToTest(resultListener:Function,delay:Number,passThroughData:Object=null,failListener:Function=null):void
        {
            const EXTRA_DELAY:Number = 100;
            
            var timer:Timer = new Timer(delay,1);
            timer.addEventListener(TimerEvent.TIMER_COMPLETE,addAsync(resultListener,delay+EXTRA_DELAY,passThroughData,failListener));
            timer.start();
        }

    }
}


